<HTML>
<HEAD>
<TITLE>ENCODING GRID</TITLE>
</HEAD>

<center>
<H1>CEOI 96 Day 1 Problem 1</h1>
<h1>Encoding Grid</H1>
</center>

<P>A kind of grid is sometimes used for encoding messages. Our naval fleet
officials decide to use this kind of encoding messages for communication
with their ship captains. The encoding grid is a square sheet of paper
divided into 2N x 2N little squares. N^2 of little squares are cut out
(see figure 1). </P>

<P>Let us briefly describe the encoding process. Take text of message of
length 4N^2. Then put an encoding grid onto a blank sheet of paper and
begin to write first N^2 letters of message into the cut little squares
(one letter per square, write letters in all cut squares in the first line
from left to right, then in the second line etc.). See example on figure
2 for message &quot;HELLOYELLOWWORLD&quot;. After finishing the first step
rotate the encoding grid 90 degrees clockwise and continue similarly writing
letters. After two more steps all letters should be written (see example
on figure 3). </P>

<font size=5>
<PRE>
                     O###                H###                 HOOY
                     ##O#                ##E#                 LREO
                     O##O                L##L                 LWEL
                     ####                ####                 LLDW

                    (fig.1)             (fig.2)              (fig.3)
</PRE>
</font>
<P>It is necessary to have a correctly constructed grid. It means that
when it is used in the way described above after each rotation new N^2
blank squares will appear under cut squares of the grid. </P>

<P>The naval fleet officials encoded thousands of messages with their grid
and then they wanted to send them to ships. Unfortunately they lost the
grid. Fortunately the naval admiral remembered the original text of one
of the messages. </P>

<P>Your task is to get this original message text and encoded text and
find one possible correctly constructed encoding grid with which the message
text could have been encoded. </P>

<H2>Input</H2>

<P>The first line of input file contains an integer N (1&lt;=N&lt;=10).
The second line contains 4N^2 capital letters representing the original
message. The next 2N lines contain the encoded text (each line 2N capital
letters). </P>

<H2>Output</H2>

<P>The output file contains a correctly constructed grid with which given
message could have been encoded. In each of 2N lines one line of grid (2N
characters) will be displayed where &quot;O&quot; (capital letter 'O' represents
cut square and &quot;#&quot; uncut square. </P>

<H2>Sample Input</H2>
<pre>
2
HELLOYELLOWWORLD
HOOY
LREO
LWEL
LLDW
</pre>

<h2>Sample Output</h2>
<pre>
O###
##O#
O##O
####
</PRE>
</BODY>
</HTML>
